package org.edu.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Proxy;

@Entity
@Proxy(lazy = false)
@Table(name = "NOTESP", catalog = "SCHOOL")
public class Notesp implements Serializable {

	private static final long serialVersionUID = 1L;

	private Long notesp_id;
	private StudentProject studentProject;
	private String midterm_exam;
	private String midterm_exam2;
	private String final_exam;

	@Id
	@Column(name = "NOTESP_ID", unique = true, nullable = false)
	@GeneratedValue(generator = "gen")
	@GenericGenerator(name = "gen", strategy = "foreign", parameters = @Parameter(name = "property", value = "studentProject"))
	public Long getNotesp_id() {
		return notesp_id;
	}

	public void setNotesp_id(Long notesp_id) {
		this.notesp_id = notesp_id;
	}

	@OneToOne
	@PrimaryKeyJoinColumn
	public StudentProject getStudentProject() {
		return studentProject;
	}

	public void setStudentProject(StudentProject studentProject) {
		this.studentProject = studentProject;
	}

	@Column(name = "MIDTERM_EXAM", length = 5)
	public String getMidterm_exam() {
		return midterm_exam;
	}

	public void setMidterm_exam(String midterm_exam) {
		this.midterm_exam = midterm_exam;
	}

	@Column(name = "MIDTERM_EXAM2", length = 5)
	public String getMidterm_exam2() {
		return midterm_exam2;
	}

	public void setMidterm_exam2(String midterm_exam2) {
		this.midterm_exam2 = midterm_exam2;
	}

	@Column(name = "FINAL_EXAM", length = 5)
	public String getFinal_exam() {
		return final_exam;
	}

	public void setFinal_exam(String final_exam) {
		this.final_exam = final_exam;
	}

	public Notesp() {
		super();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((final_exam == null) ? 0 : final_exam.hashCode());
		result = prime * result
				+ ((midterm_exam == null) ? 0 : midterm_exam.hashCode());
		result = prime * result
				+ ((midterm_exam2 == null) ? 0 : midterm_exam2.hashCode());
		result = prime * result
				+ ((notesp_id == null) ? 0 : notesp_id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Notesp other = (Notesp) obj;
		if (final_exam == null) {
			if (other.final_exam != null)
				return false;
		} else if (!final_exam.equals(other.final_exam))
			return false;
		if (midterm_exam == null) {
			if (other.midterm_exam != null)
				return false;
		} else if (!midterm_exam.equals(other.midterm_exam))
			return false;
		if (midterm_exam2 == null) {
			if (other.midterm_exam2 != null)
				return false;
		} else if (!midterm_exam2.equals(other.midterm_exam2))
			return false;
		if (notesp_id == null) {
			if (other.notesp_id != null)
				return false;
		} else if (!notesp_id.equals(other.notesp_id))
			return false;
		return true;
	}
	
}